package com.tjetc.mapper;

import com.tjetc.domain.District;
import com.tjetc.domain.Hospital;
import com.tjetc.domain.RankRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface HospitalMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Hospital record);

    int insertSelective(Hospital record);

    Hospital selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Hospital record);

    int updateByPrimaryKey(Hospital record);

    Hospital selectByIdWithDepartments(Integer id);

    @Select("select * from hospital")
    List<Hospital> selectAll();

    @Select("select hospital.* from hospital,clinic where clinic.h_id = hospital.id and clinic.id = #{cid} ")
    Hospital selectByCid(Integer cid);

    @Select("select * from hospital where name like '%${name}%' and address like '%${address}%'")
    List<Hospital> listHospital(@Param("name") String name, @Param("address") String address);

    List<Hospital> findByName(String name);

    List<Hospital> findByHosDep(@Param("hosInput") String hosInput, @Param("depInput") String depInput);

    List<Hospital> findByHos(@Param("hosInput") String hosInput);

    List<Hospital> findByDep(@Param("depInput") String depInput);

    List<Hospital> allHospital(@Param("sgId") Integer sgId, @Param("location") String location, @Param("pageSize") Integer pageSize);

    @Select("select count(*) from hospital;")
    int getCountHos();

    @Select("select * from district where city_id = 1")
    List<District> getAllDistrict();

    List<Hospital> getHosByDis(@Param("district") String district,@Param("level") String level);

    List<Hospital> getAllByName(String name);

    @Select("select * from hospital where name=#{hospitalName}")
    Hospital selectByHospitalName(String hospitalName);

    Integer updateHos(@Param("id") Integer id,@Param("desc") String desc,@Param("guidance") String guidance,@Param("prompt") String prompt);
}